public class Test {
    public static int feibo(int x){
        int last1=1;
        int last2=1;
        int sum =0;
        for(int i=3;i<=x;i++){
            sum=last1+last2;
            last2=last1;
            last1=sum;
        }
        return sum;
    }
    public static void main(String[] args) {
        int N=5;
        int num=feibo(N);
        System.out.println("第"+N+"个是"+num);
    }
    public  static int max(int a,int b){
        return Math.max(a,b);
    }
    public  static double max(double a,double b,double c){
        if(a>b){
            if(a>c){
                return a;
            }else {
                return c;
            }

        }else {
            if(b>c){
                return b;
            }else {
                return c;
            }

        }
    }
    public static void main12(String[] args) {
        int a = 10;
        int b = 133;
        double z = 10.3;
        double x = 12.4;
        double v = 14.3;
        int max1 = max(a,b);
        double max2 = max(z,x,v);
        System.out.println(max1);
        System.out.println(max2);

    }
    public static int jieCheng(int n){//阶乘
        int temp = 1;
        for(int i=1;i<=n;i++){
             temp*=i;
        }
        return temp;
    }
    public static int summ(int n){//阶乘和
        int sum = 0;
        for(int i =1;i<=n;i++){
            sum+=jieCheng(i);
        }
        return sum;
    }
    public static void main43(String[] args) {
        int N = 5;
        int resoult = jieCheng(N);
        System.out.println(resoult);

        int sum = summ(N);
        System.out.println(sum);
    }
    //2个数最大值
    public static  int max2(int a, int b){
        if (a>b){
            return a;
        }else {
            return b;
        }
    }
    //3个数最大值
    public static int max3(int a,int b,int c){
        int d=max2(a,b);
        return max2(c,d);
    }
    public static void mainmax(String[] args) {
        int x = 100;
        int y = 200;
        int max =max2(x,y);
        System.out.println("max="+max);
        int z = 300;
        int max0 = max3(x,y,z);
        System.out.println("max0:"+max0);
    }

    public  static int add (int a ,int b ,int c){
        return a+b+c;
    }


    /*public static  返回值 方法名(形式参数值) {
        方法体
    }*/
    public static int add(int a,int b ) {
        return  a + b;
    }

    public static double add(double a,double b ,double c) {
        return a+b+c;
    }

    public static void main11(String[] args) {
        int x = 10;
        int y = 12;
        int ret = add(x,y);
        System.out.println(ret);

//方法的重载
        double s = 10.2;
        double f = 20.3;
        double d = 20.4;
        double num = add(s,f,d);
        System.out.println(num);

    }
    public static  int  sum(int a,int b) {
        return a+b;
    }


    public static void main1(String[] args) {
        int x= 10;
        int y= 12;
        int num = sum(x,y);
        System.out.println(num);

    }
}
